package com.mgface.zookeeper.zkclient;

import org.I0Itec.zkclient.ZkClient;

public class GetChildren {

	public static void main(String[] args) {
		ZkClient client = new ZkClient("127.0.0.1:2181", 10_000, 10_000);
		client.subscribeChildChanges("/zk",(parentPath,currentChilds)->{
			System.out.println("parentPath:"+parentPath+",currentChilds:"+currentChilds);
		});
		client.createPersistent("/zk/c1", true);
		System.out.println("--"+client.getChildren("/zk"));
		client.createPersistent("/zk/c1/c2", true);
		client.delete("/zk/c1/c2");
		client.deleteRecursive("/zk");
		System.out.println("~~"+client.getChildren("/"));
	}

}
